package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.MrqViolation;
import com.dhcc.DRGsHosp.facade.dto.MrqViolationDTO;

public class MrqViolationAssembler {

	public static MrqViolationDTO toDTO(MrqViolation mrqViolation){
		if( mrqViolation == null ){
			return null;
		}
		MrqViolationDTO mrqViolationDTO = new MrqViolationDTO();
		//没有setId
		mrqViolationDTO.setPmainIndex(mrqViolation.getPmainIndex());
		mrqViolationDTO.setRuleCode(mrqViolation.getRuleCode());
		mrqViolationDTO.setScoreCode(mrqViolation.getScoreCode());
		mrqViolationDTO.setWeightCode(mrqViolation.getWeightCode());
		
		return mrqViolationDTO;
	}
	
	public static List<MrqViolationDTO>  toDTOs(Collection<MrqViolation>  mrqViolationMore){
		if ( mrqViolationMore == null) {
			return null;
		}
		List<MrqViolationDTO> mdrdList = new ArrayList<MrqViolationDTO>();
		for (MrqViolation mrqViolation : mrqViolationMore) {
			mdrdList.add( toDTO(mrqViolation) );
		}
		return mdrdList;		
	}
	
	public static MrqViolation toEntity(MrqViolationDTO mrqViolationDTO){
		if( mrqViolationDTO == null ){
			return null;
		}
		MrqViolation mrqViolation = new MrqViolation();
		
		//没有setId
		mrqViolation.setPmainIndex(mrqViolationDTO.getPmainIndex());
		mrqViolation.setRuleCode(mrqViolationDTO.getRuleCode());
		mrqViolation.setScoreCode(mrqViolationDTO.getScoreCode());
		mrqViolation.setWeightCode(mrqViolationDTO.getWeightCode());
		
		return mrqViolation;
	}
	
	public static List<MrqViolation>  toEntities(Collection<MrqViolationDTO>  mrqViolationDTOMore){
		if ( mrqViolationDTOMore == null) {
			return null;
		}
		List<MrqViolation> mdrList = new ArrayList<MrqViolation>();
		for (MrqViolationDTO mrqViolationDTO : mrqViolationDTOMore) {
			mdrList.add( toEntity(mrqViolationDTO) );
		}
		return mdrList;		
	}
	
}
